package com.erci.mapper;

import com.erci.entity.DTO.UserUpdateDTO;
import com.erci.entity.DTO.UserUserUpdateDTO;
import com.erci.entity.User;
import com.erci.entity.VO.UserVO;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;

@Mapper
public interface UserMapper {


    Page<UserVO> queryList(String keyword);


    void add(User user);

    @Delete("delete from user where id=#{id}")
    void deleteById(Integer id);

    @Update("update user set username=#{username},role=#{role},update_time=#{updateTime} where id=#{id}")
    void updateById(User user);
    @Select("select * from user where username=#{username} and password=#{password}")
    User loginByPassword(String username, String password);

    @Select("select * from user where phone= #{phone}")
    User findByPhone(String phone);

    void userUpdate(User user);

    @Update("update user set phone= #{phone} where id= #{id}")
    void unbindPhone(Integer id, String phone);

    @Select("select * from user where phone=#{phone} and password=#{password}")
    User loginByPhone(String phone, String password);
}
